<!--
 * @Author: zqx me_zqx@163.com
 * @Date: 2025-09-15 11:07:56
 * @LastEditors: zqx me_zqx@163.com
 * @LastEditTime: 2025-09-15 15:13:38
 * @FilePath: /XMate-h5/src/views/orderVisit/attendList.vue
 * @Description:  
 * 
 * Copyright (c) 2025 by ${git_name_email}, All Rights Reserved. 
-->
<template>
  <div class="flex flex-col h-screen">
    <div v-if="isMac() || isElectron()" class="mac-titlebar"></div>
    <van-nav-bar
      v-if="isMac() || isElectron()"
      title="参会人员"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="flex-auto overflow-auto flex flex-col justify-between">
      <searchAttend
        v-if="isSearing"
        @onCancel="onCancel"
        @onConfirm="handleNewAttendList"
      />
      <attendListView v-else @onClickInput="isSearing = true" attendType="inner" />
    </div>
  </div>
</template>

<script setup>
import { computed, ref, onMounted, onBeforeMount } from "vue";
import { isMac, isElectron } from "@/utils/platformTool";

import searchAttend from "./searchAttend.vue";
import attendListView from "./attendListView.vue";
import { useOrderVisitStore } from "@/store";
import { useRoute, useRouter } from "vue-router";

const isSearing = ref(false);
const store = useOrderVisitStore();
const route = useRoute();
const router = useRouter();

onMounted(() => {
  store.setCurrentType(1);
});

function onClickLeft() {
  router.back();
}

function onClickCreate() {}

function onCancel() {
  isSearing.value = false;
}

function handleNewAttendList(list) {
  console.log("handleNewAttendList: ", list);
  isSearing.value = false;
  if (list.length > 0) {
    store.addInnerAttendList(list);
  }
}
</script>

<style lang="less" scoped></style>
